【CentOS】CentOS8.1 系统盘/根目录扩容方法等内容

您所在的位置:网站首页 centos 根目录扩容 【CentOS】CentOS8.1 系统盘/根目录扩容方法等内容

【CentOS】CentOS8.1 系统盘/根目录扩容方法等内容

2024-07-15 13:48| 来源: 网络整理| 查看: 265

用运营商的镜像安装云服务器,选择Linux系统的发行版 CentOS8.1, 云盘500G,内存16G; 但是安装好系统会发现根目录 很小只有8G 需要调整到50G. 现在讲调整的过程记录下来。

基本概念

PV(Physical Volume)- 物理卷 物理卷在逻辑卷管理中处于最底层,它可以是实际物理硬盘上的分区,也可以是整个物理硬盘,也可以是raid设备。

VG(Volumne Group)- 卷组 卷组建立在物理卷之上,一个卷组中至少要包括一个物理卷,在卷组建立之后可动态添加物理卷到卷组中。一个逻辑卷管理系统工程中可以只有一个卷组,也可以拥有多个卷组。

LV(Logical Volume)- 逻辑卷 逻辑卷建立在卷组之上,卷组中的未分配空间可以用于建立新的逻辑卷,逻辑卷建立后可以动态地扩展和缩小空间。系统中的多个逻辑卷可以属于同一个卷组,也可以属于不同的多个卷组。

CentOS8.1 中文语言改为英文语言 #vim /etc/locale.conf LANG="zh_CN.UTF-8" 修改为 LANG=en_US.UTF-8 #reboot

重启动生效

CentOS8.1 图像化启动改为字符多用户 [root@centos8 etc]# more inittab # inittab is no longer used. # # ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM. # # Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target # # systemd uses 'targets' instead of runlevels. By default, there are two main targets: # # multi-user.target: analogous to runlevel 3 # graphical.target: analogous to runlevel 5 # # To view current default target, run: # systemctl get-default # # To set a default target, run: # systemctl set-default TARGET.target [root@centos8 etc]# systemctl set-default multi-user.target Removed /etc/systemd/system/default.target. Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/multi-user.target. [root@centos8 etc]# reboot

重启动生效

CentOS8.1 系统盘/根目录扩容 1. 查看磁盘大小及剩余空间 [root@centos8 ~]# df -Th Filesystem Type Size Used Avail Use% Mounted on devtmpfs devtmpfs 7.8G 0 7.8G 0% /dev tmpfs tmpfs 7.8G 0 7.8G 0% /dev/shm tmpfs tmpfs 7.8G 8.9M 7.8G 1% /run tmpfs tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup /dev/mapper/cl-root xfs 8.0G 4.1G 3.9G 52% / /dev/vda1 ext4 976M 143M 766M 16% /boot tmpfs tmpfs 1.6G 4.0K 1.6G 1% /run/user/0 2. 查看硬盘数量和分区情况 [root@centos8 ~]# fdisk -l Disk /dev/vda: 540 GiB, 579820584960 bytes, 1132462080 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x1cdf0571 Device Boot Start End Sectors Size Id Type /dev/vda1 * 2048 2099199 2097152 1G 83 Linux /dev/vda2 2099200 20971519 18872320 9G 8e Linux LVM Disk /dev/mapper/cl-root: 8 GiB, 8585740288 bytes, 16769024 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/mapper/cl-swap: 1 GiB, 1073741824 bytes, 2097152 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes 3. 对未分配的磁盘分区 [root@centos8 ~]# fdisk /dev/vda Welcome to fdisk (util-linux 2.32.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): n Partition type p primary (2 primary, 0 extended, 2 free) e extended (container for logical partitions) Select (default p): p Partition number (3,4, default 3): First sector (20971520-1132462079, default 20971520): Last sector, +sectors or +size{K,M,G,T,P} (20971520-1132462079, default 1132462079): +42GB Created a new partition 3 of type 'Linux' and of size 39.1 GiB. Command (m for help): P P: unknown command Command (m for help): p Disk /dev/vda: 540 GiB, 579820584960 bytes, 1132462080 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x1cdf0571 Device Boot Start End Sectors Size Id Type /dev/vda1 * 2048 2099199 2097152 1G 83 Linux /dev/vda2 2099200 20971519 18872320 9G 8e Linux LVM /dev/vda3 20971520 103002111 82030592 39.1G 83 Linux Command (m for help): w The partition table has been altered. Syncing disks. 4. 将磁盘分区表变化信息通知内核,系统重新加载分区表 [root@centos8 ~]# partprobe -s /dev/vda: msdos partitions 1 2 3 5. 创建物理卷 [root@centos8 ~]# pvcreate /dev/vda3 Physical volume "/dev/vda3" successfully created. 6. 查看lvm卷 [root@centos8 ~]# pvdisplay --- Physical volume --- PV Name /dev/vda2 VG Name cl PV Size


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3